﻿using FPSO.Models.Domain;
using FPSO.Models.ViewModel.Controls;
using FPSO.Services;
using FPSO.Services.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace FPSO.HMI.Controls
{
    /// <summary>
    /// UCBarList.xaml 的交互逻辑
    /// </summary>
    public partial class UCBarListVertical : UserControl
    {
        private BarListViewModel viewModel = null;
        private IDataBindingService bindingService = null;

        public UCBarListVertical()
        {
            InitializeComponent();

            viewModel = new BarListViewModel();
            DataContext = viewModel;

        }

        public void StartReal()
        {
            bindingService = new RealDataBindingServiceImpl<BarListViewModel>(SysConfig.PDBConnStr, viewModel);
        }

        public bool IsInitBindingService()
        {
            return bindingService != null;
        }

        public void ReflushUIValues(DateTime currentTime)
        {
            if (bindingService != null)
            {
                bindingService.ReflushData(currentTime);
            }
        }
		public void SetTankStatus(ManualCalcResult calcResult)
		{
			if (bindingService != null)
			{
				bindingService.ReflushData(calcResult);
			}
		}

	}
}
